﻿Chenxin.UI.HouseBaseInfoForm=Chenxin.extend(Chenxin.UI.FormCommon,{
	actionUrl:'service/HouseMgr.ashx',
	id:'housebaseinfoWin',
	renderTo:'jqm_housebaseinfoform',
	jqmWidth: 710,
	alwaysCheckPermit: true,
	protectBy:'',
	ppcVal:{},
	defBBtn:true,
	show:function(){
		var _this=this;
		if(this.allowPrivate==undefined){
			Chenxin.ajax({
				type:"get",
				data: {op:'checkallowprivate'},
				async:false,
				url:this.actionUrl,
				onSuccess: function(data,msg) {
					_this.allowPrivate=data.allowPrivate;
					if(!_this.allowPrivate){
						$('.tr-allowprivate').hide();
					}else{
						$('.tr-allowprivate').show();
					}
				}
			});
		}
		return Chenxin.UI.HouseBaseInfoForm.superclass.show.call(this);
	},
	beforeFitData:function(model){
		this.form.currentModel=this.currentModel;
		this.form.findByName('CustomerName').attr('readonly','readonly');
		
		//this.form.building.initValue=model.BuildingId;
		// this.form.building.param.CommunityId=model.CommunityId;
		// this.form.building.reload(model.BuildingId);
		
		// this.form.loadBuildingInfo(model.BuildingId);
		
		 //this.form.currentBlock=model.Block;
		 //this.form.currentArea=model.HouseBlock;
		// this.form.block.param.subkey=this.form.region.;
		// this.form.block.reload(_this.currentCommunityInfo.Block);
		
		model.IsGroup=model.IsGroup+'';
		switch(model.BusinessKind){
			case 10://出售
				$('.tr_rentprice').hide();
				$('.tr_saleprice').show();
				break;
			case 20://出租
				$('.tr_rentprice').show();
				$('.tr_saleprice').hide();
				break;
			default://租售
				$('.tr_rentprice').show();
				$('.tr_saleprice').show();
				break;
		}
		this.isProtectPhone=model.IsProtectPhone;
		if(model.IsProtectPhone){
			$('.protectPhone').show();	
		}else{
			$('.protectPhone').hide();	
		}
		this.form.checkNeedArea(model.CompanyId);
	},
	
    showProtectPhone: function(type, value) {		
		if(this.scope.currentModel.IsProtectPhone){//原始数据如果是有保护电话，则有保护电话
			return;
		}
		
		if(value){
			value+='';
		}
		if(value=='请选择'){
			return;
		}
		if(!this.ppcVal[type]){//没有判断过，插入
			this.ppcVal[type]=value;
			if(this.scope.isProtectPhone){//已经是保护，无需判断
				return;
			}else{//不是保护状态，判断并保护
				for(var i=0;i<this.ppConfig.length;i++){
					var tc=this.ppConfig[i];
					if(tc.ConfigType==type&&tc.ConfigMinValue<=value&&tc.ConfigMaxValue>=value){
						this.scope.isProtectPhone=true;
					}
				}
			}
		}else{//已经判断过
			if(this.ppcVal[type]==value){
				return;
			}
			
			this.ppcVal[type]=value;
			var e=false;
			for(var t in this.ppcVal){//循环判断队列
				for(var i=0;i<this.ppConfig.length;i++){//循环配置队列
					var tc=this.ppConfig[i];
					if(tc.ConfigType==t&&tc.ConfigMinValue<=this.ppcVal[t]&&tc.ConfigMaxValue>=this.ppcVal[t]){
						e=true;
						break;
					}
				}				
				if(e){
					break;
				}
			}
			this.scope.isProtectPhone=e;
		}
		if(this.scope.isProtectPhone){
			$('.protectPhone').show();			
		}else{
			$('.protectPhone').hide();
		}
    },
	getPPCList:function(){		
        var _this = this;
        Chenxin.ajax({
            url: '/service/ProtectedPhoneConfigMgr.ashx?op=getppclist',
			data:{},
            onSuccess: function(data, msg) {
				_this.ppConfig=data.ppc;
            }
        });
	},
	checkNeedArea:function(companyid){
		var _this=this;
		Chenxin.ajax({				
			type: "get",
			dataType: "json",
			url: '/service/communitymgr.ashx?op=checkneedarea',
			data: {companyid:companyid},
			onSuccess: function(data,msg) {
				//var area=_this.findByName('HouseBlock');
				//area.required=data.needArea;
				//area.setDisable();
				//_this.findByName('HouseBlock').required=data.needArea;
				$('.tr_housearea')[data.needArea?'show':'hide']();
			}
		});
	},
	afterGetFormJson:function(model){
		if(this.form.op=='edit'&&this.currentModel){
			model.IsAutoProPhone = this.isProtectPhone;
			if (model.IsAutoProPhone == undefined) {
				model.IsAutoProPhone = false;
			}

			if (model.IsAutoProPhone) {
				model.IsProtectPhone = true;
			}
			
			Chenxin.applyIf(model,this.currentModel);
			Chenxin.apply(this.currentModel,model);
		}
	},
	formValidator:function(model){
		var msg='';
		switch(model.BusinessKind){
			case '10'://出售，无需填写出租价格
				if(!model.SalePrice_T){
					msg='请填写出售总价！';
				}
				break;
			case '20'://出租，无需填写出售价格
				if(!model.RentPrice){
					msg='请填写出租价格！';
				}
				break;
			case '30'://出售和出租价格都需要填写			
				if(!model.SalePrice_T){
					msg='出售总价';
				}				
				if(!model.RentPrice){
					if(msg){
						msg+='和出租价格';
					}else{
						msg='出租价格'
					}
				}
				if(msg){
					msg='请填写'+msg+'!';
				}				
				break;
		}
		if(msg){
			alert(msg);
			return false;
		}
		return Chenxin.UI.HouseBaseInfoForm.superclass.formValidator.call(this,model);
	},
	initFormValidator:function(){
		var _this=this;
		 //小区非空验证
        $("#txtCommunity").formValidator({ 	
			validatorgroup:this.id,
            onshow: "请输入小区名称！", 
			onfocus: "中文或拼音", 
			oncorrect: " " 
        }).inputValidator({ //非空验证
            min:1, 
			empty:{ 
				leftempty: false, 
				rightempty: false, 
				emptyerror: "小区名称不能为空!" 
			}, 
			onerror: "小区名称不能为空!" 
        });
        /*
        //房间号非空验证
        $("#txtRoom").formValidator({ 	
			validatorgroup:this.id,
            onshow: "请输入房间号！", 
			onfocus: "请输入房间号", 
			oncorrect: " " 
        }).functionValidator({
			fun:function(val,elem){
				if(_this.currentBuildingModel){
					if(_this.currentBuildingModel.RoomRule=='*'||_this.currentBuildingModel.RoomRule==''){//独栋别墅
						return true;
					}
					eval('s=/'+_this.currentBuildingModel.RoomRule+'/');
					return s.test(val);
				}
				return '请先选择楼栋！';
			},
			onerror:'房间号格式错误！'
		});*/
		
        //面积验证
        $("#txtBuildingArea").formValidator({ 	
			validatorgroup:this.id,
            onshow: "请输入房源面积！", 
			onfocus: "请输入房源面积", 
			oncorrect: " " 
        }).inputValidator({ //非空验证
            min: 1, 
			empty: { 
				leftempty: false, 
				rightempty: false, 
				emptyerror: "面积不能为空!" 
			}, 
			onerror: "面积不能为空!" 
        }).functionValidator({ //数字验证
            fun:function(val,elem) { 
				val=Chenxin.Fn.fullToHalfChar(val);
                if (parseInt(val) <= 0||parseInt(val)>10000000) {
                    return false;
                }
                else {
                    return val.isNum();
                }
			}, 
			onerror: "请输入非0数字"
        });
        
		//客户姓名非空验证
        $("#txtCustomerName").formValidator({	
			validatorgroup:this.id,
			onshow: "请输入客户姓名！", 
			onfocus: "请输入客户姓名", 
			oncorrect: " " 
		}).inputValidator({ 
			min: 1, 
			empty: { 
				leftempty: false, 
				rightempty: false, 
				emptyerror: "客户姓名不能为空!" 
			}, 
			onerror: "客户姓名不能为空!" 
		});
		
		//手机号码验证
        $("#txtMobile").formValidator({	
			validatorgroup:this.id,
			onshow:"请输入手机",
			onfocus:"请输入手机", 
			oncorrect: " ", onerror : ""
        }).functionValidator({
            fun:function(val,elem) {                
                if(val.isBlank()||val.isMobile()){
					return true;
				}
				return "请输入正确的手机号";  
            }
        }); 
		
		/*
		//电话
        $("#txtPhone").formValidator({	
			validatorgroup:this.id,
			onshow:"请输入电话",
			onfocus:"请输入电话", 
			oncorrect: " ", onerror : ""
        }).functionValidator({
            fun:function(val,elem) {                
                // if ($("#txtMobile").val().isBlank()){
                    // return '请输入电话';
                // } 
                if (!$("#txtPhone").val().isBlank()) {
                    if (!$("#txtPhone").val().isTel()) {
                       return "请输入正确的电话,规则:国家代码(2到3位)-区号(2到3位)-电话号码(7到8位)-分机号(3位)";
                    }
                }                
                return true;
            }
        }); 
		*/
        
        //价格验证
		/**/
        $("#txtSalePrice_T").formValidator({	
			validatorgroup:this.id, 
            onshow: "请输入出售总价(元)", 
			onfocus: "请输入出售总价(元)", 
			oncorrect: " " 
        }).functionValidator({ //数字验证
            fun:function(val,elem) { 
				if(parseInt(val)>10000000000||parseInt(val)<0){
					return '请输入小于10,000,000,000大于0的数字';
				}
                if (!$("#txtSalePrice_R").val().isBlank()) {
                    if (parseInt($("#txtSalePrice_R").val()) > parseInt(val)) {
                        $.formValidator.setTipState(document.getElementById("txtSalePrice_R"), "onError", "底价不能大于总价");
                    }
                }

                return val.isNum();
			}, onerror: "请输入数字"
        });
        
        $("#txtSalePrice_R").formValidator({ 	
			validatorgroup:this.id,
            onshow: " ", 
			onfocus: " ", 
			oncorrect: " " 
        }).functionValidator({ //数字验证
            fun:function(val,elem) { 
				if(parseInt(val)>10000000000||parseInt(val)<0){
					return '请输入小于10,000,000,000大于0的数字';
				}
                if (!val.isBlank()) {
                    if (parseInt($("#txtSalePrice_T").val()) < parseInt(val))
                        return false;
                }

                return true;
            }, onerror: "底价不能大于总价"
        });

        $("#txtCur_Floor").formValidator({
            validatorgroup: this.id,
            onshow: "",
            onfocus: "",
            oncorrect: " "
        }).functionValidator({ //数字验证
            fun: function(val, elem) {
                return val.isNum();
            }, onerror: "请输入数字"
        });
        $("#txtTotal_Floor").formValidator({
            validatorgroup: this.id,
            onshow: "",
            onfocus: "",
            oncorrect: " "
        }).functionValidator({ //数字验证
            fun: function(val, elem) {
                return val.isNum();
            }, onerror: "请输入数字"
        });
  		$("#txtRentPrice").formValidator({ 	
			validatorgroup:this.id,
            onshow: "请输入出租价格(元)", 
			onfocus: "请输入出租价格(元)", 
			oncorrect: " " 
        }).functionValidator({ //数字验证
            fun: function(val, elem) {
				if(parseInt(val)>10000000000||parseInt(val)<0){
					return '请输入小于10,000,000,000大于0的数字';
				}
                if (!$("#txtRentPrice_R").val().isBlank()) {
                    if (parseInt($("#txtRentPrice_R").val()) > parseInt(val)) {
                        $.formValidator.setTipState(document.getElementById("txtRentPrice_R"), "onError", "底价不能大于总价");
                    }
                }

                return val.isNum();
            }, onerror: "请输入数字"
        });
        
        $("#txtRentPrice_R").formValidator({ 	
			validatorgroup:this.id,
            onshow: " ", onfocus: " ", oncorrect: " " 
        }).functionValidator({ //数字验证
            fun:function(val,elem) { 
				if(parseInt(val)>10000000000||parseInt(val)<0){
					return '请输入小于10,000,000,000大于0的数字';
				}
                if (!val.isBlank()) {
                    if (parseInt($("#txtRentPrice").val()) < parseInt(val))
                        return false;
                }

                return true;
            }, onerror: "底价不能大于总价"
        });
        
		
				
			$("#txtModel_Room").formValidator({
            validatorgroup: this.id,
            onshow: "",
            onfocus: "请输入数字",
            oncorrect: ""
        }).inputValidator({
            min: 1,
            empty: {
                leftempty: false,
                rightempty: false,
                emptyerror: "室不能为空!"
            },
            onerror: "室不能为空!"
        }).functionValidator({ //数字验证
            fun: function(val, elem) {
                return val.isNum();
            }, onerror: "请输入数字"
        });
		
		$("#txtModel_Hall").formValidator({
            validatorgroup: this.id,
            onshow: "",
            onfocus: "请输入数字",
            oncorrect: ""
        }).inputValidator({
            min: 1,
            empty: {
                leftempty: false,
                rightempty: false,
                emptyerror: "厅不能为空!"
            },
            onerror: "厅不能为空!"
        }).functionValidator({ //数字验证
            fun: function(val, elem) {
                return val.isNum();
            }, onerror: "请输入数字"
        });
		
		$("#txtModel_Toilet").formValidator({
            validatorgroup: this.id,
            onshow: "",
            onfocus: "请输入数字",
            oncorrect: ""
        }).inputValidator({
            min: 1,
            empty: {
                leftempty: false,
                rightempty: false,
                emptyerror: "卫不能为空!"
            },
            onerror: "卫不能为空!"
        }).functionValidator({ //数字验证
            fun: function(val, elem) {
                return val.isNum();
            }, onerror: "请输入数字"
        });
		
		$("#txtCur_Floor").formValidator({
            validatorgroup: this.id,
            onshow: "",
            onfocus: "请输入数字",
            oncorrect: ""
        }).inputValidator({
            min: 1,
            empty: {
                leftempty: false,
                rightempty: false,
                emptyerror: "楼层不能为空!"
            },
            onerror: "楼层不能为空!"
        }).functionValidator({ //数字验证
            fun: function(val, elem) {
                return val.isNum();
            }, onerror: "请输入数字"
        });
		$("#txtTotal_Floor").formValidator({
            validatorgroup: this.id,
            onshow: "",
            onfocus: "请输入数字",
            oncorrect: ""
        }).inputValidator({
            min: 1,
            empty: {
                leftempty: false,
                rightempty: false,
                emptyerror: "总楼层不能为空!"
            },
            onerror: "总楼层不能为空!"
        }).functionValidator({ //数字验证
            fun: function(val, elem) {
                return val.isNum();
            }, onerror: "请输入数字"
        });
		
		
		
		//保护电话
        $("#txtDisplayPhone").formValidator({			
			validatorgroup:this.id,
            onshow: "请输入保护电话！", onfocus: "请输入保护电话", oncorrect: " " 
        }).functionValidator({ //手机号验证
            fun:function(val,elem) {
				if(!_this.isProtectPhone){//如果不需要填写，不验证
					return true;
				}
				
				if(val.length>50||val.length==0){
					return false;
				}
				return true;
				
				//return (val.isMobile() || val.isTel());
			}, 
			onerror: "请输入正确的电话"
        });
	},
	createComboList:function(){
		var _this=this;
		var year=new Date().getFullYear();
		var yearItems=[];
		for(var i=year-30;i<=year;i++){
			yearItems.push({txt:i,val:i});
		}	
		//房屋类型
		var buildingType=new Chenxin.UI.ParameterCombo({
			containerId:'#house_BuildingType',
			name:'BuildingType',
			key:'Building.Type',
			inModelType:'txt',			
			autoLoad:true,
			tbxWidth:60,
			required:true,
			afterSetValue:function(newVal,oldVal){
				//_this.showProtectPhone.call(_this,this.key,this.getValue());				
			},
			onSelected:function(){
				_this.showProtectPhone.call(_this,this.key,this.getValue());
			}
		});
		//房屋用途
		this.houseUse=new Chenxin.UI.ParameterCombo({
			containerId: '#house_CommunityUse',
			name: 'HouseUse',
			key:'House.Use',
			inModelType:'txt',
			tbxWidth:60,
			required:true,
			afterSetValue:function(newVal,oldVal){
				//_this.showProtectPhone.call(_this,this.key,this.getValue());				
			},
			onSelected:function(){
				_this.showProtectPhone.call(_this,this.key,this.getValue());
			}
		});
		//朝向
		var houseToward=new Chenxin.UI.ParameterCombo({
			containerId: '#house_Direction',
			name: 'Direction',
			key:'System.Toward',
			inModelType:'txt',
			tbxWidth:60
		});
		//产权情况
		var houseProperty=new Chenxin.UI.ParameterCombo({
			containerId: '#house_Property',
			name: 'Property',
			key:'House.Property',
			inModelType:'txt',
			tbxWidth:60
		});
		//信息来源
		var houseSource=new Chenxin.UI.ParameterCombo({
			containerId: '#house_InfoSource',
			name: 'InfoSource',
			key:'House.Source',
			inModelType:'txt',
			tbxWidth:60
		});
		//支付方式
		var housePaymode=new Chenxin.UI.ParameterCombo({
			containerId: '#house_PayMode',
			name: 'PayMode',
			key:'House.Paymode',
			inModelType:'txt',
			tbxWidth:60	
		});
		//房源现状
		var houseActuality=new Chenxin.UI.ParameterCombo({
			containerId: '#house_Actuality',
			name: 'Actuality',
			key:'House.Actuality',
			inModelType:'txt',
			tbxWidth:60,
			required:true	
		});
		//装修程度
		var fitment=new Chenxin.UI.ParameterCombo({
			containerId: '#house_Fitment',
			name: 'Fitment',
			key:'House.Fitment',
			inModelType:'txt',
			tbxWidth:60
		});
		//建筑年限
		var completeYear=new Chenxin.UI.BuildingYearCombo({
			containerId:'#house_CompleteYear',
			tbxWidth:60		
		}); 
		/*
		//楼栋
		this.building=new Chenxin.UI.Combo({
			actionUrl:'service/CommunityBuildingMgr.ashx?op=getcombolist',
			containerId:'#house_building',
			typeModel:'new',
			name:'BuildingId',
			inModelType:'all',
			disable:true,
			colNum:4,
			tbxWidth:60,
			txtModelName:'BuildingName',
			autoLoad:false,
			onSelected:function(){
				
				_this.loadBuildingInfo(this.getValue());
			}<%--<div style="z-index: 914; margin-right: 5px;" id="house_building" class="SelectWrapSingle"></div>--%>
		});*/
		
		/*
		this.region=new Chenxin.UI.ParameterCombo({
			name:'Region',
			containerId:'#house_region',
			key:'System.Region',
			tbxWidth:60,
			inModelType:'txt',
			afterSetValue:function(newVal){
				if(newVal==this.defVal){
					_this.block.clearItems();
					_this.area.clearItems();
				}else{
					_this.block.param.subkey=newVal;
					_this.block.reload(_this.currentBlock);
					
					
					_this.area.param.subkey=newVal;
					_this.area.reload(_this.currentArea);
				}
			},
			onSelected:function(){
				if(this.getValue()==this.defVal){
					_this.block.clearItems();
					_this.area.clearItems();
				}else{
					_this.block.param.subkey=this.getValue();
					_this.block.reload();
					
					_this.area.param.subkey=this.getValue();
					_this.area.reload();
				}
			}
		});
		this.block=new Chenxin.UI.ParameterCombo({
			containerId: '#house_block',
			name:'Block',
			key:'System.Block',
			tbxWidth:60,
			colWidth:90,
			inModelType:'txt',
			autoLoad:false
		});
		
		
		this.area=new Chenxin.UI.ParameterCombo({
			containerId: '#house_Area',
			name:'HouseBlock',
			key:'System.Area',
			tbxWidth:60,
			colWidth:90,
			inModelType:'txt',
			autoLoad:false
		});
		
		return [buildingType,this.houseUse,houseToward,houseProperty,houseSource,housePaymode,houseActuality,fitment,completeYear,this.region,this.block,this.area];
		*/
		return [buildingType,this.houseUse,houseToward,houseProperty,houseSource,housePaymode,houseActuality,fitment,completeYear];
		
	},
	loadBuildingInfo:function(modelId){	
		if(modelId=='请选择'){
			$('#span_RoomRuleRemark').remove();
			if(this.currentBuildingModel){
				delete this.currentBuildingModel
			}			
			return;
		}
	
		var _this=this;
		Chenxin.ajax({
			type: "post",
			dataType: "json",
			url:'service/CommunityBuildingMgr.ashx?op=getmodel',
			data: {op:'getmodel',modelid:modelId},
			onSuccess: function(data) {
				_this.currentBuildingModel=data.model;
				if($('#span_RoomRuleRemark').length){
					$('#span_RoomRuleRemark').text(data.model.RoomRuleRemark);
				}else{
					$('#txtRoom').after('<span id="span_RoomRuleRemark" style="color:#ff0000;">'+data.model.RoomRuleRemark+'</span>');				
				}
				if(_this.op!='edit'){
					_this.findByName('Room').val('');
				}
				if(data.model.RoomRule=='*'||data.model.RoomRule==''){//独栋别墅，无需填写房间号
					$('.tr_roomnumber').hide();
				}else{
					$('.tr_roomnumber').show();				
				}
				
				if(_this.currentBuildingModel.Floor==null){
					_this.currentBuildingModel.Floor='';
				}
				//$('#txtTotal_Floor').val(_this.currentBuildingModel.Floor);
			}		
		});
	},
	initEvent:function(){
		var _this=this;
		$('#housebaseinfo_Save').live('click',function(){
			_this.save();
		});
		$('#housebaseinfo_Cancle').live('click',function(){
			_this.hide();
		});
					
		$('.checkEquip').click(function(){
			var _val=$('#BaseEquip').val();
			if(this.checked){
				$('#BaseEquip').val(_val+this.value+',');
			}else{
				$('#BaseEquip').val(_val.replace(this.value+',',''));
			}
		});
	},
	createForm:function(){
		return Chenxin.FormCommon.houseBaseInfoForm('housebaseinfo');
	},
	initComponent:function(){
		Chenxin.UI.HouseBaseInfoForm.superclass.initComponent.call(this);
		this.getPPCList();
	}
});

/**
*房源弹出层表单内容
*<tr><th><span class="isfilled">*</span>区域：</th><td><div style="z-index: 913; margin-right: 5px;" id="house_region" class="SelectWrapSingle"></div></td><th>板块：</th><td><div style="z-index: 908; margin-right: 5px;" id="house_block" class="SelectWrapSingle"></div></td></tr><tr class="tr_housearea"><th><span class="isfilled"></span>片区：</th><td colspan="3"><div style="z-index: 909; margin-right: 5px;" id="house_Area" class="SelectWrapSingle"></div></td></tr>
*/
Chenxin.FormCommon.houseBaseInfoForm=function(comboIdPrefix) {
return '<table class="tbl_f jqTabWh"><tbody><tr><th style="width:70px;"><span class="isfilled">*</span>小区名称：</th><td style="width:250px;"><div style="float:left"><input type="text" size="30" style="width: 90px;" value="" class="inputbox_n" id="txtCommunity" name="Community" disabled="disabled"/></div><div id="txtCommunityTip" style="float: left; margin-left: 5px; width: 121px;  text-align: left;" class="fl"></div></td><th style="width:70px;"><span class="isfilled">*</span>房屋用途：</th><td><div style="z-index: 910; margin-right: 5px;" id="house_CommunityUse" class="SelectWrapSingle"></div></td></tr><tr><th> <span class="isfilled">*</span>楼栋：</th><td><input type="text" size="30" style="width: 90px;" maxlength="14" value="" class="inputbox_n"  name="BuildingName" disabled="disabled"/></td><th><span class="isfilled"></span>建筑年代：</th><td><div style="z-index: 909; margin-right: 5px;" id="house_CompleteYear" class="SelectWrapSingle"></div></td></tr><tr><th>区域：</th><td><input type="text" size="30" style="width: 90px;" value="" class="inputbox_n" name="Region" disabled="disabled"/></td><th>板块：</th><td><input type="text" size="30" style="width: 90px;" value="" class="inputbox_n" name="Block" disabled="disabled"/></td></tr><tr class="tr_housearea"><th><span class="isfilled"></span>片区：</th><td colspan="3"><input type="text" size="30" style="width: 90px;" value="" class="inputbox_n" name="HouseBlock" disabled="disabled"/></td></tr><tr><th>地址：</th><td colspan="3"><input class="inputbox_n" name="Address" tyle="text" style="width:425px;" disabled="disabled"/></td></tr><tr><th><span class="isfilled">*</span>交易类型：</th><td><input type="radio" name="BusinessKind" value="10" checked="checked" onclick="setBusinessKind(this);" />出售<input type="radio" name="BusinessKind" value="20" onclick="setBusinessKind(this);"/>出租  <input type="radio" name="BusinessKind" value="30"onclick="setBusinessKind(this);" />租售</td><th><span class="isfilled">*</span>建筑类型：</th><td><div style="z-index: 907; margin-right: 5px;" id="house_BuildingType" class="SelectWrapSingle"></div></td></tr><tr class="tr_roomnumber"><th> <span class="isfilled">*</span>房间号：</th><td colspan="3"><input disabled="disabled" type="text" size="30" style="width: 90px;" maxlength="14" value="" class="inputbox_n fl" id="txtRoom" name="Room" /><div id="txtRoomTip" style="float: left; margin-left: 5px; width: 121px;  text-align: left;" class="fl"></div></td></tr><tr><th> <span class="isfilled">*</span>房源状态：</th><td><input type="radio" id="radio4" name="Status" value="10" checked="checked" />有效<input type="radio" id="radio5" name="Status" value="20" />暂缓<input type="radio" id="radio10" name="Status" value="-1" />无效</td><th><span class="isfilled">*</span>房源现状：</th><td><div style="z-index: 906; margin-right: 5px;" id="house_Actuality" class="SelectWrapSingle"></div></td></tr><tr><th><span class="isfilled">*</span>面积：</th><td><div style="float:left"><input type="text" size="30" style="width: 60px;" maxlength="14" value="" class="inputbox_n" id="txtBuildingArea" name="BuildingArea"/> 平方米</div><div id="txtBuildingAreaTip" style="float: left; margin-left: 5px; width: 120px;  text-align: left;" class="fl"></div>  </td><th><span class="isfilled">*</span>客户姓名：</th><td><div style="float:left"><input type="text" size="30" style="width: 90px;" maxlength="14" value="" class="inputbox_n" id="txtCustomerName" name="CustomerName" readonly="readonly"/></div><div id="txtCustomerNameTip" style="float: left; margin-left: 5px; width: 120px;  text-align: left;" class="fl"></div>  </td></tr><tr class="protectPhone"><th><span class="isfilled">*</span>保护电话：</th><td colspan="3"><div style="float:left"><input type="text" size="30" style="width: 90px;" maxlength="14" value="" class="inputbox_n fl" id="txtDisplayPhone" name="DisplayPhone"/></div><div id="txtDisplayPhoneTip" style="float: left; margin-left: 5px; width: 120px;  text-align: left;" class="fl"></div>  </td></tr><tr class="tr_saleprice"><th><span class="isfilled">*</span>出售总价：</th><td><div style="float:left"><input type="text" style="width: 90px;" value="" maxlength="12" class="inputbox_n" id="txtSalePrice_T" name="SalePrice_T" /></div><div id="txtSalePrice_TTip" style="float: left; margin-left: 5px; width: 120px;  text-align: left;" class="fl"></div>  </td><th><span class="isfilled">*</span>出售底价：</th><td><div style="float:left"><input type="text" style="width: 90px;" maxlength="12" value="" class="inputbox_n fl PFLT" id="txtSalePrice_R" name="SalePrice_R" /></div><div id="txtSalePrice_RTip" style="float: left; margin-left: 5px; width: 120px;  text-align: left;" class="fl"></div>  </td></tr><tr class="tr_rentprice" style="display:none;"><th><span class="isfilled">*</span>出租价格：</th><td><div style="float:left;"><input type="text" style="width: 90px;" value="" maxlength="12" class="inputbox_n" id="txtRentPrice" name="RentPrice" /></div><div id="txtRentPriceTip" style="float: left; margin-left: 5px; width: 120px;  text-align: left;" class="fl"></div></td><th><span class="isfilled">*</span>出租底价：</th><td><div style="float:left"><input type="text" maxlength="12" style="width: 90px;" value="" class="inputbox_n" id="txtRentPrice_R" name="RentPrice_R" /></div><div id="txtRentPrice_RTip" style="float: left; margin-left: 5px; width: 120px;  text-align: left;" class="fl"></div></td></tr><tr class="tr_rentprice" style="display:none;"><th><span class="isfilled"></span>是否合租：</th><td><input type="radio" id="radio6" name="IsGroup" value="true" />是<input type="radio" id="radio7" name="IsGroup" value="false" checked="checked" />否</td><th><span class="isfilled"></span>支付方式：</th><td><div style="z-index: 905; margin-right: 5px;" id="house_PayMode" class="SelectWrapSingle"></div></td></tr><tr><th> <span class="isfilled"></span>房型：</th><td><input type="text" size="30" style="width: 31px;" maxlength="3" value="" class="inputbox_n" id="txtModel_Room" name="Model_Room" />室<input type="text" size="30" style="width: 31px;" maxlength="3" value="" class="inputbox_n" id="txtModel_Hall" name="Model_Hall" />厅<input type="text" size="30" style="width: 31px;" maxlength="3" value="" class="inputbox_n" id="txtModel_Toilet" name="Model_Toilet" />卫<input type="text" size="30" style="width: 31px;" maxlength="3" value="" class="inputbox_n" id="txtModel_Balcony" name="Model_Balcony" />阳台</td><th><span class="isfilled"></span>层高：</th><td><input type="text" style="width: 30px;" value="" class="inputbox_n PNUM LEN3" id="txtCur_Floor" name="Cur_Floor" maxlength="3"  />&nbsp;/总层高：<input type="text" maxlength="3"  style="width: 30px;" value="" class="inputbox_n PNUM LEN3" id="txtTotal_Floor" name="Total_Floor" /></td></tr><tr><th><span class="isfilled"></span>装修情况：</th><td><div style="z-index: 904; margin-right: 5px;" id="house_Fitment" class="SelectWrapSingle"></div></td><th><span class="isfilled"></span>朝向：</th><td><div style="z-index: 903; margin-right: 5px;" id="house_Direction" class="SelectWrapSingle"></div></td></tr><tr><th> <span class="isfilled"></span>产权情况：</th><td><div style="z-index: 902;margin-right: 5px;" id="house_Property" class="SelectWrapSingle"></div></td><th> <span class="isfilled"></span>来源：</th><td><div style="z-index: 901;margin-right: 5px;" name="来源" id="house_InfoSource" class="SelectWrapSingle"></div></td></tr><tr><th> <span class="isfilled"></span>房源配置：</th><td><textarea id="BaseEquip" onkeypress="if (this.value.length>=200){event.returnValue=false}"  onchange="if (this.value.length>=200){this.value=this.value.substr(0, 200)}" name="BaseEquip" cols="80" rows="3" class="textarea_n" style="width: 250px; height: 25px; padding:5px;"></textarea></td><td colspan="2"><input type="checkbox" value="水" class="checkEquip" /> 水<input type="checkbox" value="电" class="checkEquip"/>电<input type="checkbox" value="煤气" class="checkEquip"/>煤气<input type="checkbox" value="暖气" class="checkEquip"/> 暖气<input type="checkbox" value="有线电视" class="checkEquip"/> 有线电视<input type="checkbox" value="宽带" class="checkEquip"/>宽带<input type="checkbox" value="电视机" class="checkEquip"/>电视机<br/><input type="checkbox" value="冰箱" class="checkEquip"/>冰箱<input type="checkbox" value="空调" class="checkEquip"/>空调<input type="checkbox" value="洗衣机" class="checkEquip"/>洗衣机<input type="checkbox" value="热水器" class="checkEquip"/>热水器<input type="checkbox" value="微波炉" class="checkEquip"/>微波炉<input type="checkbox" value="电话" class="checkEquip"/>电话<br /></td></tr><tr><th> <span class="isfilled"></span>备注：</th><td colspan="3"><textarea name="Remarks" onkeypress="if (this.value.length>=200){event.returnValue=false}"  onchange="if (this.value.length>=200){this.value=this.value.substr(0, 200)}" cols="80" rows="3" class="textarea_n" style="width: 480px; height: 25px; padding:5px;"></textarea></td></tr><tr class="tr-allowprivate" style="display:none"><td style="text-align:right;">房源类型：</td><td><input type="radio" name="IsProtectHouse" value="false" checked="checked" />公盘<input type="radio" name="IsProtectHouse" value="true" />私盘</td></tr></tbody></table>'
};

function setBusinessKind(obj){	
	switch(obj.value){
		case '10'://出售
			$('.tr_rentprice').hide();
			$('.tr_saleprice').show();
			break;
		case '20'://出租
			$('.tr_rentprice').show();
			$('.tr_saleprice').hide();
			break;
		default://租售
			$('.tr_rentprice').show();
			$('.tr_saleprice').show();
			break;
	}
}